<?
include('seguridad.php');
include('bd.php');
Conectar();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
 <HEAD>
  <TITLE> BideYoday </TITLE>
  <META NAME="Generator" CONTENT="DILAPER">
  <META NAME="Author" CONTENT="Power by Sebastian Costa - Design: Nadia De Cinti">
  <META NAME="Keywords" CONTENT="">
  <META NAME="Description" CONTENT="">
  <link href="../style.css" rel="stylesheet" type="text/css">
  <script src="../js/botonera.js" type="text/javascript"></script>
 </HEAD>

 <BODY topmargin="0">
<center>
<table width="990" height="100%" cellspacing="0" cellpadding="0" class="fondo" border="0">
	<tr>
		<td width="100%" height="100%" align="center" valign="top">
			<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0">
				<tr>
					<td align="center" valign="top">
<div style="height: 135px"></div>
<!-- contenido -->
<table width="800"  border="0" class="admin_area" cellspacing="0" cellpadding="0">
	<tr bgcolor="#ffffff">
		<td align="right" height="30">
Welcome <?echo $_SESSION['usuario'];?>&nbsp;|&nbsp;<a href="salir.php"><font color="red">Log Out</font></a>&nbsp;&nbsp;
		</td>
	</tr>	
	<tr><td height="3"></td></tr>
	<tr bgcolor="#ffffff">
		<td align="right" height="50">
<?include('menu.php');?>
		</td>
	</tr>	
	<tr><td height="3"></td></tr>
	<tr bgcolor="#ffffff">
		<td align="left" valign="top" height="300"  class="tabla_central">
<div style="margin: 10px">
<b><span class="titulo_admin">Orders</span></b><br>
<br>

<table width="100%" border="0" class="tabla_admin">
	<tr>
		<td align="center" bgcolor="#ffffff">
<b>Code</b>
		</td>
		<td align="center" bgcolor="#ffffff">
<b>Date</b>
		</td>
		<td align="center" bgcolor="#ffffff">
<b>Price</b>
		</td>
		<td align="center" bgcolor="#ffffff">
<b>Status</b>
		</td>
		<td align="center" bgcolor="#ffffff">
<b>Actions</b>
		</td>
	</tr>
<?
// paginascion
$registros = '50';// cuanto emprendimientos por pagina
if (!$_GET[pagina]) { 
   $inicio = 0; 
   $pagina = 1; 
}else { 
 $inicio = ($_GET[pagina] - 1) * $registros; 
$pagina=$_GET[pagina];
} 

  $result= mysql_query("SELECT * FROM carrito_close ORDER BY fecha_pedido DESC"); 
  $total_registros = mysql_num_rows($result); 
  $result= mysql_query("SELECT * FROM carrito_close ORDER BY fecha_pedido DESC LIMIT $inicio, $registros");
  $total_paginas = ceil($total_registros / $registros);
$w=1;
while($row = mysql_fetch_array($result, MYSQL_ASSOC)){
	if($bg_num%2==0){
$bg='bgcolor="#B4B4B4"';
}else{
$bg='bgcolor="#DDDDDD"';
}
?>

	<tr id="d_<?echo$w;?>">
		<td align="left" <?echo$bg;?>>
<div style="margin-left: 5px; margin-right: 5px;"><?echo$row[codigo_pedido];?></div>
		</td>
		<td align="left" <?echo$bg;?>>
<div style="margin-left: 5px; margin-right: 5px;"><?echo$row[fecha_pedido];?></div>
		</td>
		<td align="left" <?echo$bg;?>>
<?
$total_d= substr($row[total], 0, strlen($row[total]) -2);
$total_c= substr($row[total], -2, 2);
?>
<div style="margin-left: 5px; margin-right: 5px;">$<?echo$total_d.','.$total_c;?>.</div>
		</td>
		<td align="left" <?echo$bg;?>>
<div style="margin-left: 5px; margin-right: 5px;"><?echo$row[estado];?></div>
		</td>
		<td align="right" <?echo$bg;?>>
<span style="cursor: pointer" onclick="location.href='orders_client.php?code=<?echo$row[codigo_pedido]?>'"><b>Client</b></span>&nbsp;<br>
		</td>
	</tr>
<?$bg_num++;
$w++;}?>
</table>
	<div style="width: 800px; text-align: center;"><br>
<?
//paginacion
if(($pagina - 1) > 0) {
echo "<a href='orders.php?pagina=".($pagina-1)."' style='color=#330066; text-decoration:none'>.:anterior&nbsp;</a>";
}
for ($i=1; $i<=$total_paginas; $i++){ 
   if ($pagina == $i) 
      echo "<b>&nbsp;".$pagina."&nbsp;- </b>"; 
   else
echo "<a href='orders.php?pagina=".$i."' style='color=#330066; text-decoration:none'>".$i."&nbsp;</a>- ";
}
if(($pagina + 1)<=$total_paginas) {
   echo "<a href='orders.php?pagina=".($pagina+1)."' style='color=#330066; text-decoration:none'>siguiente:.</a></center>";
}
?>
	</div>
</div>
<br>
		</td>
	</tr>
</table>
<table width="800" border="0" class="admin_area" cellspacing="0" cellpadding="0">
	<tr>
		<td height="3">

		</td>
	</tr>
	<tr bgcolor="#ffffff">
		<td align="right">
Area of administration of contendios of the web bidetoday.com &nbsp;&nbsp;&nbsp;
		</td>
	</tr>
</table>
<!-- fin contenido -->
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>
</center>
 </BODY>
</HTML>
<?Desconectar();?>